<div class="category-tree-modal">
    <div style="background-color: #F5F5F5;">
        <ul class="category-root">
            <li th:each="category : ${parentCategories}" th:inline="text">
                <a th:href="@{${'/' + sectionKey + '/' + category.id}}">
                    [[${category.name}]]
                </a>
                <span th:if="${category.url != null}" th:text="${'(' + category.url + ')'}" />
                <ul th:substituteby="views/categoryTree::tree" />
            </li>
        </ul>
    </div>

    <div th:remove="all">
        <ul th:fragment="tree" th:unless="${#lists.isEmpty(category.childCategoryXrefs)}">
            <li th:each="cxref : ${category.childCategoryXrefs}" th:inline="text">
                <a th:href="@{${'/' + sectionKey + '/' + cxref.subCategory.id}}">
                    [[${cxref.subCategory.name}]]
                </a>
                <span th:if="${cxref.subCategory.url != null}" th:text="${'(' + cxref.subCategory.url + ')'}" />
                <div th:with="category=${cxref.subCategory}" th:remove="tag">
                    <ul th:substituteby="views/categoryTree::tree" />
                </div>
            </li>
        </ul>
    </div>

</div>